import request from '../utils/request'

// 提交诉求
export const submitRequest = (data) => {
  return request({
    url: '/request/submit',
    method: 'post',
    data
  })
}

// 获取我的诉求列表
export const getMyRequests = (params) => {
  return request({
    url: '/request/my-requests',
    method: 'get',
    params
  })
}

// 删除诉求
export const deleteRequest = (requestId) => {
  return request({
    url: `/request/${requestId}`,
    method: 'delete'
  })
}

// ========== 管理员接口 ==========

// 获取所有诉求列表（管理员）
export const getAllRequests = (params) => {
  return request({
    url: '/admin/requests',
    method: 'get',
    params
  })
}

// 管理员处理诉求
export const processRequest = (data) => {
  return request({
    url: '/admin/requests/process',
    method: 'post',
    data
  })
}

// 获取诉求统计
export const getRequestStats = () => {
  return request({
    url: '/admin/requests/stats',
    method: 'get'
  })
}

